#!/usr/bin/python

import sys

wc_hash = {}


for eachLine in sys.stdin:
    eachLine = eachLine.strip()
    usr_name = eachLine.split("\t")[0]
    usr_keyword = eachLine.split("\t")[1]

    if(wc_hash.has_key(usr_name) == False):
        wc_hash[usr_name] = {}
    
    if(wc_hash[usr_name].has_key(usr_keyword) ==  False):
        wc_hash[usr_name][usr_keyword] = 0

    wc_hash[usr_name][usr_keyword] += 1

for eachUser in wc_hash.keys():
    resultString = eachUser
    
    for eachKeyword in wc_hash[eachUser].keys():
        resultString += "\t" +eachKeyword+":"+str(wc_hash[eachUser][eachKeyword])

    print resultString
    

